package fnord.network.calculator;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import fnord.illuminati.card.ActionTime;
import fnord.illuminati.card.Alignment;
import fnord.illuminati.card.Connection;
import fnord.illuminati.card.GroupCard;
import fnord.illuminati.card.IlluminatiCard;
import fnord.illuminati.card.groupcards.TestGroupCard;
import fnord.illuminati.card.illuminaticards.TestIlluminatiCard;
import fnord.illuminati.order.AttackType;

public class DefenseCalculatorTests {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testCalculate() {
		fail("Not yet implemented"); // TODO
	}

	@Test
	public void testGetDefenseValue() {
		Alignment[] card1Alig = {Alignment.COMMUNIST, Alignment.CONSERVATIVE};
		Connection[] card1Con = {Connection.NORTH, Connection.EAST};
		GroupCard testCard = new TestGroupCard("GropuCard1", "THIS CARD GROPES THINGS IN JAPAN", null, ActionTime.NEVER, 3, 0, 5, 2, 0, card1Alig, card1Con);
		GroupCard parentCard = new TestGroupCard("GropuCard2", "THIS CARD GROPES THINGS IN JAPAN", null, ActionTime.NEVER, 3, 0, 5, 2, 0, card1Alig, card1Con);
		parentCard.addCard(testCard, Connection.EAST);
		IlluminatiCard ic = new TestIlluminatiCard("illin card", "THIS CARD GROPES THINGS IN JAPAN", null, ActionTime.NEVER, 3, 0, 2, 0, card1Alig, null);
		ic.addCard(parentCard, Connection.WEST);
		Alignment[] oppAlig = {Alignment.COMMUNIST};
		DefenseCalculator controlCalc = new DefenseCalculator(testCard, oppAlig, AttackType.CONTROL, null);
		assertEquals(controlCalc.getDefenseValue(), 6);
		
		DefenseCalculator neutCalc = new DefenseCalculator(testCard, oppAlig, AttackType.NEUTRALIZE, null);
		assertEquals(neutCalc.getDefenseValue(), 0);
		
		DefenseCalculator destCalc = new DefenseCalculator(testCard, oppAlig, AttackType.DESTROY, null);
		assertEquals(destCalc.getDefenseValue(), 12);
	}

}
